/**
	Interface of input.

	All class need Tick(float time) ,should implement this interface.
	Tick notification is dispatched by DEMOGameState_XXX Tick(float deltaTime) function .

	Where we should use observer pattern , 
	let every subclass of this interface know Tick() notifications.

	//	I think it is not a pure interface, cause there're no pure virtual function.
*/

#ifndef	__DEMOI_ACTOR_H__
#define	__DEMOI_ACTOR_H__

#include"interface.h"
#include"..\..\..\include\hge.h"
#include<stdio.h>

class DEMO_Actor
{

protected:
	const static float renderHeartBeatRate;
	const static float logicHeartBeatRate;

	virtual void tick(float deltaTime)
	{
		static float timeElapsed = 0.0f;
		static float timeElapsedAnother = 0.0f;

		timeElapsed += deltaTime;
		if( timeElapsed >= renderHeartBeatRate)
		{
			OnHeartBeat_Render();
			timeElapsed = 0.0f;
		}

		timeElapsedAnother += deltaTime;
		if( timeElapsedAnother >= logicHeartBeatRate)
		{
			OnHeartBeat_Logic();
			timeElapsedAnother = 0.0f;
		}

	}

	virtual void OnHeartBeat_Render()
	{
		printf("OnHeartBeat_Render...");
	}

	virtual void OnHeartBeat_Logic()
	{
		printf("OnHeartBeat_Logic...");
	}
};

#endif	//__DEMOI_ACTOR_H__